<template>
	<view class="uni-container">

		<view :class="{'pc-hide': hideList.indexOf(item.url) !== -1  && hasLeftWin}" class="uni-panel"
			v-for="item in lists" :key="item.url" v-if="item.isShow">
			<view :class="{'left-win-active': leftWinActive ===  item.url && hasLeftWin}" class="uni-panel-h"
				@click="goDetailPage(item.url)">
				<text class="uni-panel-text">{{item.name}}</text>
				<text class="uni-panel-icon uni-icon">&#xe470;</text>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			hasLeftWin: {
				type: Boolean
			},
			leftWinActive: {
				type: String
			}
		},
		data() {
			return {
				hideList: [
					'load-more'
				],
				project: null,
				lists: [{
						name: "返青调查",
						value: '返青期',
						url: "greenPlot",
						isShow: true
					},
					{
						name: "盛期调查",
						value: '盛期',
						url: "peakPeriodPlot",

						isShow: true
					},

					{
						name: "枯黄调查",
						value: '枯黄期',
						url: "yellowPlot",
						isShow: true
					}
				]
			};
		},
		onLoad(e) {
			if (e && e.data) {
				this.project = JSON.parse(decodeURIComponent(e.data))
				this.initBtns()

			}
		},


		methods: {
			goDetailPage(path) {
				let data={
					action:'creat',
					projectName:this.project.projectName,
					surveyType:this.project.surveyType
				}
				
				const url = '/pages/sampleplot/sampleplot/' + path+"?data="+  encodeURIComponent(JSON.stringify(data))
				uni.navigateTo({
					url: url
				})

			},
			initBtns() {
				this.lists.forEach(d => {

					if (this.project.surveyType.includes(d.value)) {
						d.isShow = true
					} else {
						d.isShow = false
					}
				})
				console.log(this.list)
			}
		}
	}
</script>

<style>
	@import '@/common/uni-nvue.css';
</style>